package com.hengpeng.itfin.job;

import java.util.Date;
import java.util.List;

import com.hengpeng.common.cis.ComponentContextLoader;
import com.hengpeng.common.scheduling.AbstractJob;
import com.hengpeng.common.scheduling.ScheduleConfig;
import com.hengpeng.common.util.DateTimeUtil;
import com.hengpeng.itfin.service.ServiceFactory;
import com.hengpeng.itfinbase.persist.CreditAssign;
import com.hengpeng.itfinbase.persist.CreditAssign.AssignStatus;

/**
 * <pre>
 * 债权转让过期截止检查
 * </pre>
 * @author weiyuan
 * @version 1.0, 2015年8月10日
 */
public class AssignEndJob extends AbstractJob
{
	@Override
	public void exec(boolean isTimeout, ScheduleConfig config)
	{
		log.info("债权转让过期截止检查作业开始,时间：" + DateTimeUtil.formatToStr(new Date(), DateTimeUtil.DATE_FORMAT_YMDHMS));
		ServiceFactory serviceFactory = ComponentContextLoader.getBean(ServiceFactory.class);

		List<CreditAssign> creditAssigns = serviceFactory.getAssignService().getCreditAssigns(
				new AssignStatus[] { AssignStatus.PUBLISHED });
		serviceFactory.getAssignService().endAssign(creditAssigns);
		log.info("债权转让过期截止检查作业结束,时间：" + DateTimeUtil.formatToStr(new Date(), DateTimeUtil.DATE_FORMAT_YMDHMS));
	}

	public static void main(String[] args)
	{

	}
}
